package net.huashitong.common.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.common.dao.SysTroubleDao;
import net.huashitong.common.entity.SysTrouble;
import net.huashitong.common.filter.SysTroubleFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysTroubleService extends StringPKService<SysTrouble> {
    @Autowired
    private SysTroubleDao sysTroubleDao;
    @Autowired
    private SysTableService tableService;
    @Override
    protected BaseDao<SysTrouble, String> getDao() {
        return sysTroubleDao;
    }

    @Override
    protected void beforeSave(SysTrouble obj) {
        obj.setSysId(tableService.updateMaxSysId("t_common_trouble", null));
    }

    public List<SysTrouble> queryByFilter(SysTroubleFilter filter){
        return sysTroubleDao.queryByFilter(filter);
    }
}
